home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / FUZZY.ZIP / CITY < prev    next >
Text File  |  1988-01-28  |  978b  |  32 lines

  1. {
  2.    City -- This is a simple program which uses fuzzy logic to determine
  3.            how "nice" various cities are.
  4.                                                                           }
  5.  
  6. nice_city(X) :- location(X) ^ fuzzy(0.5) | characteristics(X) ^ fuzzy(0.9).
  7.  
  8. location(X) :- city(X), climate(X).
  9. climate(X) :- warm(X), dry(X).
  10.  
  11. characteristics(X) :- population(X,Pop), Val = Pop/2500000.0,
  12.                         ( fuzzy(Val) ^ fuzzy(0.9) ) |
  13.                         ( (not expensive(X)) ^ fuzzy(0.5) ).
  14.  
  15. city(albuquerque).
  16. warm(albuquerque) :- fuzzy(0.9).
  17. dry(albuquerque) :- fuzzy(0.9).
  18. population(albuquerque, 500000).
  19. expensive(albuquerque) :- fuzzy(0.6).
  20.  
  21. city(boston).
  22. warm(boston) :- fuzzy(0.5).
  23. dry(boston) :- fuzzy(0.6).
  24. population(boston, 2000000).
  25. expensive(boston) :- fuzzy(0.9).
  26.  
  27. city(ft_worth).
  28. warm(ft_worth) :- fuzzy(0.9).
  29. dry(ft_worth) :- fuzzy(0.7).
  30. population(ft_worth, 1500000).
  31. expensive(ft_worth) :- fuzzy(0.8).
  32.